//
//  GoodsScrollTableViewCell.m
//  Youhuiju
//
//  Created by 余尚飞 on 16/8/2.
//  Copyright © 2016年 yutenys. All rights reserved.
//

#import "GoodsScrollTableViewCell.h"
#import "YHJAutoScrollView.h"
#import "UIImageView+WebCache.h"
//#import "SMSellingImageNetWorkTool.h"
//#import "GoodsModel.h"

@interface GoodsScrollTableViewCell ()<YHJAutoScrollViewDatasource,YHJAutoScrollViewDelegate>
@property (strong, nonatomic)YHJAutoScrollView *autoScrollView;
//@property (weak, nonatomic) IBOutlet NSLayoutConstraint *scrollHeight;

@property (strong, nonatomic) NSArray  *goods;
@property (nonatomic, strong) NSArray   *tmpImages;
@end

@implementation GoodsScrollTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self)
    {
//        self.autoScrollView = [[YHJAutoScrollView alloc]initWithFrame:CGRectMake(0, 0, 375 * FitW,355 * FitH)];
//        self.autoScrollView.autoScrollDataSource = self;
//        self.autoScrollView.autoScrollDelegate = self;
//        [self.contentView addSubview:self.autoScrollView];
        
    }
    return self;
}

//- (void)getImagesByPara:(NSDictionary *)paras
//{
//    //    WeakObj(self);
//    //    [[SMSellingImageNetWorkTool shareInstance] getGoodsWithParams:paras successBlock:^(NSArray *arr) {
//    //
//    //        weakself.goods = arr;
//    //        [weakself.autoScrollView reloadData];
//    //    } failure:^(NSString *erroMessage) {
//    //
//    //    }];
//    
//    self.goods = self.tmpImages;
//    [self.autoScrollView reloadData];
//}
//
//#pragma mark - autoScroll delegate
//
//- (NSUInteger)numberOfImageInScrollView:(YHJAutoScrollView *)scrollView{
//    return self.goods.count ? : 2;
//}
//
//- (void)scrollView:(YHJAutoScrollView *)scrollView imageAtIndex:(NSUInteger)index forImageView:(UIImageView *)imageView{
//    
//    NSString *urlStr = nil;
//    
//    //    if (self.goods.count) {
//    //        urlStr = ((GoodsModel *)self.goods[index]).goodImg;
//    //    }else{
//    //        urlStr = self.tmpImages[index];
//    //
//    //    }
//    urlStr = self.tmpImages[index];
//    
//    //    [imageView sd_setImageWithURL:[NSURL URLWithString:urlStr] placeholderImage:LoadImage(@"7.jpg") completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
//    //        if (image && cacheType ==  SDImageCacheTypeNone) {
//    //            imageView.alpha = 0.;
//    //            [UIView animateWithDuration:0.4 animations:^{
//    //                imageView.alpha = 1.;
//    //            }];
//    //        }
//    //    }];
//    [imageView sd_setImageWithURL:[NSURL fileURLWithPath:urlStr]];
//}
//
//- (void)scrollView:(YHJAutoScrollView *)scrollView didTappedImageAtIndex:(NSUInteger)index{
//    
//    //    if (self.scrollViewTaped) {
//    //
//    //        self.scrollViewTaped(index,((GoodsModel *)self.goods[index]).detailURL,((GoodsModel *)self.goods[index]).title);
//    //    }
//    DLog(@"点击滑动轮播图第%ld张",index);
//}
//
//- (void)scrollView:(YHJAutoScrollView *)scrollView didDidScrollToPage:(NSUInteger)page{
//    
//}
//
//-(NSArray *)tmpImages
//{
//    if(!_tmpImages){
//        
//        _tmpImages = @[[[NSBundle mainBundle] pathForResource:@"66" ofType:@"jpg"],[[NSBundle mainBundle] pathForResource:@"77" ofType:@"jpg"],[[NSBundle mainBundle] pathForResource:@"66" ofType:@"jpg"],[[NSBundle mainBundle] pathForResource:@"77" ofType:@"jpg"]];
//    }
//    return _tmpImages;
//}

@end

